from cgitb import handler

from django.conf import settings
from django.contrib import admin
from django.urls import path, re_path, include
from django.views.static import serve

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include(('index.urls', 'index'), namespace='index')),
    path('shopper', include(('shopper.urls', 'shopper'), namespace='shopper')),
    path('commodity', include(('commodity.urls', 'commodity'), namespace='commodity')),
    re_path('media/(?P<path>.*)', serve,
            {'document_root':settings.MEDIA_ROOT}, name='media'),
]

from index import views
# 定义404和500异常的路由信息
handler404 = views.page_not_found
handler500 = views.page_error